Home > C Programming > Inbuilt Functions > Questions and Answers
01. |
With what do you replace the ???? to make the function shown below return the correct answer? long factorial (long x) { ???? return x * factorial(x - 1); } | |||||||||||
|
02. |
What will be the value of `a` after the following code is executed? #define square(x) x*x a = square(2+3) | |||||||||||
|
03. |
What would be the output of the following program? #include main() { char str[]="S\065AB"; printf("\n%d", sizeof(str)); } | |||||||||||
|
04. |
What will be the output of following statements? char x[ ] = "hello hi"; printf("%d%d",sizeof(*x),sizeof(x)); | |||||||||||
|
05. |
What will be the output of following C code? #define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); } | |||||||||||
|
06. |
What will be the output of following C code? main() { extern int i; i=20; printf("%d",sizeof(i)); } | |||||||||||
|
07. |
What will be the output of following C code? void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); } | |||||||||||
|
08. |
What will be the output of following C code? main() { while (strcmp(“someâ€,â€some\0â€)) printf(“Strings are not equal\nâ€); } | |||||||||||
|
09. |
What will be the output of following C code? void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%dâ€,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%dâ€,*cptr); } | |||||||||||
|
10. |
What is the output of following program? void main(){ printf("%d%d",sizeof(10),sizeof(5,5)); } | |||||||||||
|